package tt.dz.egobus.servicemanager.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;
import tt.dz.egobus.servicemanager.base.dao.AbstractExtendDao;
import tt.dz.egobus.servicemanager.dao.BusRegisterServiceDao;
import tt.dz.egobus.servicemanager.entities.BusRegisterService;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Anson
 * @date 17-3-14
 * @name 车注册服务dao实现类
 * @since 1.0.1
 */
@Repository("busRegisterServiceDaoImpl")
public class BusRegisterServiceDaoImpl extends AbstractExtendDao<BusRegisterService, String>
        implements BusRegisterServiceDao {
    @Override
    protected void loadInstanceClass() {
        this.setType(BusRegisterService.class);
    }

    @Override
    public int deleteRelativeByBusId(String busId) {
        String hql = " delete from BusRegisterService where  busId=:busId ";
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("busId", busId);
        Query query = this.getSession().createQuery(hql);
        query.setProperties(params);
        return query.executeUpdate();
    }
}
